import javax.swing.text.html.HTMLEditorKit.ParserCallback;
/**
 * A Helper class that extends parserCallback to enable HTML parsing 
 * to strip HTML tags from a page and return just the human readable data
 * 
 * @author Mitchell Whitehouse <aca08mw>
 * @author Andrew Evans <aca08ae>	
 * @author Duncan Grant <aca08dg>
 * @version     1                                 
 * @since       1.6                                      
 */

public class HTMLStripper extends ParserCallback {

	
	
	private String dataString;
	
	public HTMLStripper(){
		dataString = "";
	}
	
	public void reset(){
		dataString = "";
	}
	/**
	 * Method to return the text that has been found in web page
	 * 
	 * @return String the text from a page
	 */
	public String getDataString(){
		return dataString;
	}
	
	//When text found in page add to temporary string for later use
	public void handleText(char[] data, int pos) {
		dataString = dataString + (new String(data).toLowerCase()) + " ";
		//System.out.println("Test " + dataString);
	}
	public void handleError(String errorMsg,int pos){
	
	}
}
